var a = getApp();

Page({
    data: {
        inputs: "",
        active: 0,
        show: !1,
        page: 1
    },
    onLoad: function(a) {},
    goback: function(a) {
        wx.navigateBack({
            delta: 1
        });
    },
    tapinp: function(a) {
        this.setData({
            inputs: a.detail.value,
            page: 1
        }), this.getData();
    },
    onClick: function(a) {
        this.init(), console.log(a), this.setData({
            active: a.detail.index
        }), this.getData();
    },
    closeShow: function(a) {
        this.setData({
            show: !1
        });
    },
    init: function() {
        this.setData({
            show: !1,
            inputs: "",
            page: 1
        });
    },
    togoods: function(a) {
        console.log(a);
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + t
        });
    },
    tapDetail: function(a) {
        if (console.log(a), 0 == this.data.active) {
            var t = a.currentTarget.dataset.id;
            wx.navigateTo({
                url: "/packageE/others/cloudwarehouse/pickUp/pickUp?id=" + t
            });
        }
    },
    onReady: function() {
        try {
            var a = wx.getStorageSync("langIndex");
            this.setData({
                language: a.en
            });
        } catch (a) {
            console.log(a);
        }
    },
    onShow: function() {
        this.getData();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.current_page >= this.data.last_page || this.getMore();
    },
    onShareAppMessage: function() {},
    getCondition: function(t) {
        console.log(t.currentTarget.dataset);
        var e = t.currentTarget.dataset.id, o = this, n = a.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.remove-condition");
        a._getNetWork({
            url: n,
            data: {
                goods_id: e
            },
            success: function(a) {
                var t = a.data;
                1 == t.result ? (console.log(t), o.setData({
                    show: !0,
                    info: t.data
                })) : wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getData: function() {
        var t = this, e = "";
        e = "1" == Number(t.data.active) + 1 ? a.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.deposit-area") : a.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.seal-area"), 
        a._getNetWork({
            url: e,
            data: {
                name: t.data.inputs,
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? (console.log(e), t.setData({
                    list: e.data.data,
                    last_page: e.data.last_page,
                    current_page: e.data.last_page
                })) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getMore: function() {
        var t = this, e = "", o = this.data.page + 1;
        t.setData({
            page: o
        }), e = "1" == Number(t.data.active) + 1 ? a.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.deposit-area") : a.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.seal-area"), 
        a._getNetWork({
            url: e,
            data: {
                name: t.data.inputs,
                page: t.data.page
            },
            success: function(a) {
                var e = a.data;
                1 == e.result ? (console.log(e), t.setData({
                    list: t.data.list.concat(e.data.data),
                    last_page: e.data.last_page,
                    current_page: e.data.last_page
                })) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});